//
//  BXTypeView.m
//  HNJYB
//
//  Created by panshen on 2017/10/26.
//  Copyright © 2017年 Mag1cPanda. All rights reserved.
//

#import "BXTypeView.h"

@implementation BXTypeView

-(void)awakeFromNib
{
    self.type = @"";
    [super awakeFromNib];
}

- (IBAction)jqxBtnClicked:(id)sender {
    [_jqxIcon setImage:[UIImage imageNamed:@"checked_on"]];
    [_syxIcon setImage:[UIImage imageNamed:@"checked_off"]];
    isJQX = YES;
    isSYX = NO;
}

- (IBAction)syxBtnClicked:(id)sender {
    [_jqxIcon setImage:[UIImage imageNamed:@"checked_off"]];
    [_syxIcon setImage:[UIImage imageNamed:@"checked_on"]];
    isJQX = NO;
    isSYX = YES;
}

- (IBAction)confirmBtnClicked:(id)sender {
    
    if (isJQX) {
        self.type = @"1";
    }
    
    else if (isSYX) {
        self.type = @"2";
    }
    
    
    NSLog(@"%@",self.type);
    
    if ([self.type isEqualToString:@""]) {
        [Util showHudWithView:self.superview message:@"请选择保险类型" hideAfterDelay:1.0];
        return;
    }
    
    [self.superview removeFromSuperview];
    
    if (_confirmBtnClicked) {
        _confirmBtnClicked(_type);
    }
    
}

- (IBAction)cancelBtnClicked:(id)sender {
    
    [self.superview removeFromSuperview];
}

@end
